package com.zdp.algorithm.linkedlist;

/**
 * 双向链表结点
 * @author Zhengdp
 * @date 2023年02月14日 14:49
 */
public class TwoNode {

    public int data;
    public TwoNode pre;
    public TwoNode next;

    public TwoNode(){}

    public TwoNode(int data) {
        this.data = data;
    }

    public static TwoNode createNodeList(String[] nodes) {
        TwoNode head = new TwoNode();
        TwoNode pre = head;
        for(String val : nodes) {
            TwoNode cur = new TwoNode(Integer.valueOf(val));
            cur.next = pre.next;
            cur.pre = pre;
            pre.next = cur;
            pre = cur;
        }
        return head;
    }

}
